package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService ;


    /**
     * 根据名称查询敏感词
     * @param dto
     * @return
     */
    @GetMapping("/list")
    @Override
    public ResponseResult list(@RequestBody SensitiveDto dto) {

        ResponseResult list = adSensitiveService.list(dto);
        return list;
    }

    /**
     * 增加敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/insert")
    @Override
    public ResponseResult insert(@RequestBody AdSensitive adSensitive) {

        ResponseResult insert = adSensitiveService.insert(adSensitive);
        return insert;
    }

    /**
     * 更新
     * @param adSensitive
     * @return
     */
    @PutMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {

        ResponseResult update = adSensitiveService.update(adSensitive);
        return update;
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete/{id}")
    @Override
    public ResponseResult delete(@PathVariable("id") Integer id) {
        ResponseResult delete = adSensitiveService.delete(id);
        return delete;
    }
}
